<?php
/**
 * Minhlog 控制器插件
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   Minh
 * @package    Minh_Controller_Plugin
 * @copyright  Copyright (c) 2009-2010 Minh.Shu@gmail.com
 * @license    New BSD License
 * @author     Minh.Shu
 * @version    $Id: Common.php 2 2010-01-17 13:49:08Z Minh.Shu $
 *
 */

class Minh_Controller_Plugin_Common extends Zend_Controller_Plugin_Abstract
{
    public function routeShutdown (Zend_Controller_Request_Abstract $request)
    {
        $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
        $bootstrap->bootstrap('view');
        $view = $bootstrap->getResource('view');
        $module = $request->getModuleName();
        $moduleParams = $view->$module;
        $view->addScriptPath($moduleParams['scriptPath']);
        $view->addHelperPath($moduleParams['helperPath']);

        if($module == 'backend') {
            $view->headLink()->appendStylesheet('/public/css/backend/screen.css');
            $view->headScript()->offsetSetFile(100,'/public/js/jquery-ui-1.7.2.custom.min.js');
        }else{
            $view->headLink()->appendStylesheet('/public/css/screen.css');
        }

        $bootstrap->bootstrap('seo');
        $seo = $bootstrap->getResource('seo');
    }
}